<?php
require_once("../../model/loai_mon_an_model.php");
require_once("../../model/mon_an_model.php");
?>
<?php
require("../_layout/m_header.php");
 ?>
<br />
<br />
<br />
<?php
if(isset($_GET)&&isset($_GET['ma_mon_an']))
{
    $list=lay_mon_an($_GET['ma_mon_an']);
    while($row=mysqli_fetch_row($list))
    {
?>  
<h3>Cập Nhât Món Ăn</h3>
<form class="form-horizontal" enctype="multipart/form-data" method="post" action="../../controler/mon_an_controller.php" role="form">
<div class="form-group">
    <div class="col-sm-5">
      <input type="hidden" hidden="1" class="form-control" name="ma_mon_an" value="<?php echo $row[0];  ?>"/>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-5">
      <input type="hidden" hidden="1" class="form-control" name="hinh_anh_old" value="<?php echo $row[3];  ?>"/>
    </div>
  </div>
<div class="form-group">
    <label for="inputLoai3" class="col-sm-2 control-label">Tên Món Ăn</label>
    <div class="col-sm-3">
      <input type="text" class="form-control" name="ten_mon_an" value="<?php echo $row[2];  ?>"/>
    </div>
  </div>
  <div class="form-group">
    <label for="inputLoai3" class="col-sm-2 control-label">Loại Món Ăn</label>
    <div class="col-sm-3">
      <select class="form-control" name="ma_loai">
      <option>-----Chọn Loại Món Ăn-----</option>
      <?php
      $list1=lay_ds_loai();
      while($row1=mysqli_fetch_row($list1))
      {
         if($row[1]==$row1[0])
         {
            echo "<option selected value=".$row1[0].">".$row1[1]."</option>";
         }
         else
         echo "<option value=".$row1[0].">".$row1[1]."</option>";
      }
      ?>
      </select>
    </div>
  </div>
  <div class="form-group">
    <label for="inputLoai3" class="col-sm-2 control-label">Giá</label>
    <div class="col-sm-3">
      <input type="text" class="form-control" name="gia" value="<?php echo $row[5] ?>"/>
    </div>
  </div>
  <div class="form-group">
    <label for="inputMota3" class="col-sm-2 control-label">Mô tả</label>
    <div class="col-sm-3">
      <textarea name="mo_ta" class="form-control" rows="4"><?php echo $row[4] ?>"</textarea>
    </div>
  </div>
    <div class="form-group">
    <label for="inputLoai3" class="col-sm-2 control-label">Hình ảnh</label>
    <div class="col-sm-3">
      <input type="file" class="form-control" name="hinh_anh" />
      <p class="help-block">Example block-level help text here.</p>
    </div>
  </div>
  <div class="form-group">
    <label for="inputLoai3" class="col-sm-2 control-label">Trạng Thái</label>
    <div class="col-sm-2">
      <select class="form-control" name="trang_thai">
      <?php if($row[6]==1)
      {
      echo "<option selected value='1'>Hoạt Động</option>";
      echo "<option value='0'>Khóa</option>";
      }
      else 
      {
      echo "<option value='1'>Hoạt Động</option>";
      echo "<option selected value='0'>Khóa</option>";
      }
       ?>

      </select>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" name="sua_mon_an" class="btn btn-default">Cập Nhật</button> |
      <button type="submit" name="huy_mon_an" class="btn btn-default">Hủy</button>
    </div>
  </div>
</form>
<?php 
}
}
?>
<?php
require("../_layout/m_footer.php");
 ?>
